package bdcin.mineracao;


import java.io.File;
import java.io.FileReader;

import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;



public class FileDocument {

  public static Document Document(File f,long idBD)
       throws java.io.FileNotFoundException {
	 
    Document doc = new Document();

    doc.add(new Field("path", f.getPath(), Field.Store.YES, Field.Index.UN_TOKENIZED));

    doc.add(new Field("modificado",
        DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),
        Field.Store.YES, Field.Index.UN_TOKENIZED));

    doc.add(new Field("contents", new FileReader(f)));
    doc.add(new Field("idBD",String.valueOf(idBD),Field.Store.YES,Field.Index.NO));

    return doc;
  }

  private FileDocument() {}
}
    
